export default ( {$axios} ,inject ) => {

  inject('getNewCourse',(params)=>$axios({
    url:'/api/course/mostNew',
    method:'POST',
    data:params
  }))

  inject('getHotCourse',(params)=>$axios({
    url:'/api/course/mostHeat',
    method:'POST',
    data:params
  }))

  inject('queryCourse',(params)=>$axios({
    url:'/api/course/search',
    method:'POST',
    data:params
  }))

  inject('getcourseInfo',(params)=>$axios({
    url:'/api/course/getDetail',
    method:'GET',
    params:{courseId}
  }))

  inject('playCourse',(courseId,chapterId)=>$axios({
    url:'/api/player/play',
    method:'GET',
    params:{courseId,chapterId},
    headers: {
        'Authorization': Decrypt(localStorage.getItem('token'))
    }
  }))

  inject('checkAuth',(courseId)=>$axios({
    url:'/api/course/checkAuth',
    method:'GET',
    params:{courseId},
    headers: {
        'Authorization': Decrypt(localStorage.getItem('token'))
    }
  }))

  inject('checkAuthWithChapterId',(courseId,chapterId)=>$axios({
    url:'/api/course/checkAuth',
    method:'GET',
    params:{courseId,chapterId},
    headers: {
        'Authorization': Decrypt(localStorage.getItem('token'))
    }
  }))


  inject('updateStudyHour',(data,token)=>$axios({
    url:'/api/member/updateStudyHour',
    method:'POST',
    data,
    headers: {
        'Authorization': Decrypt(localStorage.getItem('token')),
        'token':token
    }
  }))

}


